/*
 * Copyright (c) 2019. ascend 版权所有禁止转载。
 */

package cn.edu.zua.demo08.module.test.controller;

import cn.edu.zua.demo08.util.LoggerUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * 说明：
 *
 * @author ascend
 * 2019/1/24 12:59
 */
@RestController
@RequestMapping("/user")
public class IndexController {
    private static final Logger log = LoggerFactory.getLogger(IndexController.class);

    @GetMapping("/login")
    public Map<String, Object> login(String name, HttpServletRequest request) {
        Map<String, Object> retMap = new HashMap<>(8);
        retMap.put("msg", "用户登陆" + name + "成功");
        request.setAttribute(LoggerUtils.LOGGER_RETURN, retMap);
        return retMap;
    }

    @PostMapping("/login2")
    public Map<String, Object> login2(String name, HttpServletRequest request) {
        Map<String, Object> retMap = new HashMap<>(8);
        retMap.put("msg", "用户登陆" + name + "成功");
        request.setAttribute(LoggerUtils.LOGGER_RETURN, retMap);
        return retMap;
    }
}
